﻿

using System;
using System.Diagnostics;


namespace Nature.Toolkit.GMix
{
	
	/// <summary>
	/// ShockCompressionVector
	/// </summary>
	 partial struct ShockCompressionVector  : Nature.Numerics.IVector
	{
		#region Indexes

		
		/// <summary>
		/// Temperature behind the shock wave
		/// </summary>
		public const int TemperatureIndex = 0;

		
		/// <summary>
		/// Pressure behind the shock wave
		/// </summary>
		public const int PressureIndex = 1;

		
		/// <summary>
		/// Compression Ratio
		/// </summary>
		public const int CompressionRatioIndex = 2;

		
		/// <summary>
		/// Mach number: U / C
		/// </summary>
		public const int MachNumberIndex = 3;

		
		#endregion

		#region Properties

		
		/// <summary>
		/// Temperature behind the shock wave
		/// </summary>
		public double Temperature
		{
			get { return m_array[0]; }
			set { m_array[0] = value; }
		}

		
		/// <summary>
		/// Pressure behind the shock wave
		/// </summary>
		public double Pressure
		{
			get { return m_array[1]; }
			set { m_array[1] = value; }
		}

		
		/// <summary>
		/// Compression Ratio
		/// </summary>
		public double CompressionRatio
		{
			get { return m_array[2]; }
			set { m_array[2] = value; }
		}

		
		/// <summary>
		/// Mach number: U / C
		/// </summary>
		public double MachNumber
		{
			get { return m_array[3]; }
			set { m_array[3] = value; }
		}

		
		#endregion

		#region Constructors

		public static ShockCompressionVector Create()
        {
            ShockCompressionVector vector = new ShockCompressionVector();
            vector.m_array = new double[4];
            return vector;
        }

		public static ShockCompressionVector Create(double temperature, double pressure, double compressionRatio, double machNumber)
        {
            ShockCompressionVector vector = new ShockCompressionVector();
            vector.m_array = new double[4];
			
			vector.m_array[0] = temperature;

			
			vector.m_array[1] = pressure;

			
			vector.m_array[2] = compressionRatio;

			
			vector.m_array[3] = machNumber;

			
            return vector;
        }

		private ShockCompressionVector(double[] array)
            : this()
        {
            if (array.Length != 4) { throw new ArgumentOutOfRangeException(); }
            m_array = array;
        }

        public static explicit  operator ShockCompressionVector (double[] array)
        {
            return new ShockCompressionVector(array);
        }

		public static implicit operator double[](ShockCompressionVector vector)
        {
            return vector.m_array;
        }

		#endregion

		#region Private Fields

		[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
		private double[] m_array;

		#endregion

		#region IVector Members

        public double this[int i]
        {
            get { return m_array[i]; }
            set { m_array[i] = value; }
        }

        public int Length
        {
            get { return m_array.Length; }
        }

        #endregion

        #region IEnumerable<double> Members

        public System.Collections.Generic.IEnumerator<double> GetEnumerator()
        {
            for(int i = 0; i < m_array.Length; ++i) { yield return m_array[i]; }
        }

        #endregion

        #region IEnumerable Members

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return m_array.GetEnumerator();
        }

        #endregion

	}

	
	/// <summary>
	/// Isentropic Compression Vector
	/// </summary>
	 partial struct IsentropicCompressionVector  : Nature.Numerics.IVector
	{
		#region Indexes

		
		/// <summary>
		/// Temperature behind the shock wave
		/// </summary>
		public const int TemperatureIndex = 0;

		
		/// <summary>
		/// Pressure behind the shock wave
		/// </summary>
		public const int PressureIndex = 1;

		
		/// <summary>
		/// Compression Ratio
		/// </summary>
		public const int CompressionRatioIndex = 2;

		
		#endregion

		#region Properties

		
		/// <summary>
		/// Temperature behind the shock wave
		/// </summary>
		public double Temperature
		{
			get { return m_array[0]; }
			set { m_array[0] = value; }
		}

		
		/// <summary>
		/// Pressure behind the shock wave
		/// </summary>
		public double Pressure
		{
			get { return m_array[1]; }
			set { m_array[1] = value; }
		}

		
		/// <summary>
		/// Compression Ratio
		/// </summary>
		public double CompressionRatio
		{
			get { return m_array[2]; }
			set { m_array[2] = value; }
		}

		
		#endregion

		#region Constructors

		public static IsentropicCompressionVector Create()
        {
            IsentropicCompressionVector vector = new IsentropicCompressionVector();
            vector.m_array = new double[3];
            return vector;
        }

		public static IsentropicCompressionVector Create(double temperature, double pressure, double compressionRatio)
        {
            IsentropicCompressionVector vector = new IsentropicCompressionVector();
            vector.m_array = new double[3];
			
			vector.m_array[0] = temperature;

			
			vector.m_array[1] = pressure;

			
			vector.m_array[2] = compressionRatio;

			
            return vector;
        }

		private IsentropicCompressionVector(double[] array)
            : this()
        {
            if (array.Length != 3) { throw new ArgumentOutOfRangeException(); }
            m_array = array;
        }

        public static explicit  operator IsentropicCompressionVector (double[] array)
        {
            return new IsentropicCompressionVector(array);
        }

		public static implicit operator double[](IsentropicCompressionVector vector)
        {
            return vector.m_array;
        }

		#endregion

		#region Private Fields

		[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
		private double[] m_array;

		#endregion

		#region IVector Members

        public double this[int i]
        {
            get { return m_array[i]; }
            set { m_array[i] = value; }
        }

        public int Length
        {
            get { return m_array.Length; }
        }

        #endregion

        #region IEnumerable<double> Members

        public System.Collections.Generic.IEnumerator<double> GetEnumerator()
        {
            for(int i = 0; i < m_array.Length; ++i) { yield return m_array[i]; }
        }

        #endregion

        #region IEnumerable Members

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return m_array.GetEnumerator();
        }

        #endregion

	}

	
}